import fetch from '@/utils/fetch'

export function addSource(data) {
  return fetch({
    url: 'bi/biSourcedatabase/add',
    method: 'POST',
    data
  })
}

export function updateSource(data) {
  return fetch({
    url: 'bi/biSourcedatabase/edit',
    method: 'PUT',
    data
  })
}

export function deleteSource(params) {
  return fetch({
    url: 'bi/biSourcedatabase/delete',
    method: 'DELETE',
    params
  })
}

export function sourceList(params) {
  return fetch({
    url: 'bi/biSourcedatabase/list',
    method: 'get',
    params
  })
}

export function tablesByBase(data) {
  return fetch({
    url: 'bi/biSourcedatabase/getAllTables',
    method: 'post',
    data
  })
}

export function saveTableConfig(data) {
  return fetch({
    url: 'bi/biSourcedatatable/addBatch',
    method: 'POST',
    data
  })
}

export function linkedTablesByBase(params) {
  return fetch({
    url: `bi/biSourcedatatable/list`,
    method: 'get',
    params
  })
}
